package com.shen.thread.reflection;

//获得类加载器
public class Test2 {
    public static void main(String[] args) throws ClassNotFoundException {
        //获得系统类的加载器
        ClassLoader loader = ClassLoader.getSystemClassLoader();
        System.out.println(loader);
        //获得扩展类加载器
        ClassLoader parent = loader.getParent();
        System.out.println(parent);
        //获得跟加载器(c/c++编写)
        ClassLoader parent1 = parent.getParent();
        System.out.println(parent1);

        //测试当前类是哪个加载器
        ClassLoader classLoader = Class.forName("com.shen.reflection.Test2").getClassLoader();
        System.out.println(classLoader);

        //获得系统类加载器可以加载的目录
        System.out.println(System.getProperty("java.class.path"));
    }
}

